#include "stdio.h"
#include "string.h"
#include "stdlib.h"

void main()
{
	int i;
	char content[100] = "hello world";
	FILE *fp = NULL;
	//char *fname = "c:\\1.txt";
	//char *fname = "c:/a1.txt"; //统一的用45度斜杠
	char *fname = "tmp.txt";
	fp = fopen(fname, "r+"); //r+ 读写文件，文件必须存在
	if (NULL == fp)
	{
		printf("func fopen（） err: %s \n", fname);
		return ;
	}

	for(i=0;i<strlen(content);i++)
	{
		fputc(content[i],fp);
	}
	
	if (fp != NULL)
	{
		fclose(fp);
	}

}
